/**
 * 解压ASAR资源包(Electron)
 *
 * 需要安装以下依赖:
 * npm install asar
 */

const path = require('path');
const asar = require('asar');

// 获取传递给脚本的参数（排除前两个默认参数）
const args = process.argv.slice(2);
let from = args[0];
let dirPath = path.dirname(from);
let extName = path.extname(from);
let asarName = path.basename(from, '.asar');
let to = path.join(dirPath, asarName);
if (extName === '.asar') {
  asar.extractAll(from, to);
}
